import React from 'react'
import "./style.less"
import { withRouter } from "react-router-dom"

function PubHeader ({ title, history }) {

  function clickHandle () {
    // history.push("/")
    // window对象提供了一个返回方案
    window.history.back();
  }

  return (
    <div id="common-header">
      <span className="back-icon" onClick={clickHandle}>
        <i className="icon-chevron-left"></i>
      </span>
      <h1>{title}</h1>
    </div>
  )
}

export default withRouter(PubHeader)
